//#include<bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<vector>
#include<map>
#include<set>

typedef unsigned long long ull;
using namespace std;
vector<int>fri;

int findFri(int x) {
	if (fri[x] == x)
		return x;
	else
		return fri[x] = findFri(fri[x]);
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int n, m, k;
	cin >> n >> m >> k;
	fri.resize(n + 1);
	map<int,set<int>>en;
	for (int i = 0;i <= n;i++) {
		fri[i] = i;
	}
	for (int i = 0;i < m;i++) {
		int a, b, op, x, y;
		cin >> a >> b >> op;
		if (op == 1)
		{
			fri[findFri(a)] = findFri(b);
		}
		else if (op == -1)
		{
			en[a].insert(b);
			en[b].insert(a);
		}
	}
	for (int i = 0;i < k;i++) {
		int a, b;
		cin >> a >> b;
		int fa = findFri(a);
		int fb = findFri(b);
		if (fa == fb && en[a].find(b) == en[a].end())
			cout << "No problem" << endl;
		else if (fa != fb && en[a].find(b) == en[a].end())
			cout << "OK" << endl;
		else if (fa == fb && en[a].find(b) != en[a].end())
			cout << "OK but..." << endl;
		else if (en[a].find(b) != en[a].end())
			cout << "No way" << endl;
	}
	return 0;
}